Skip to content

fix(Webhook): unknown error in catch block - #73

Merged
jpbberry merged 2 commits into
masterfrom
feature/fix-unknown-error
Dec 3, 2021
Merged

fix(Webhook): unknown error in catch block#73
jpbberry merged 2 commits into
masterfrom
feature/fix-unknown-error

Conversation

@jpbberry

Copy link
Copy Markdown
Member

No description provided.

@netlify

netlify Bot commented Nov 21, 2021

Copy link
Copy Markdown

✔️ Deploy Preview for topgg-node-sdk-docs ready!

🔨 Explore the source changes: 79bb5a7

🔍 Inspect the deploy log: https://app.netlify.com/sites/topgg-node-sdk-docs/deploys/619b895c6689420008f41f14

😎 Browse the preview: https://deploy-preview-73--topgg-node-sdk-docs.netlify.app

@jpbberry
jpbberry requested a review from Xetera November 21, 2021 13:50

@Xetera Xetera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the long wait for the review 😞

Comment thread src/structs/Webhook.ts
res.sendStatus(204);
}
} catch (err) {
this.options.error?.(err);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused, what exactly is getting thrown from functions that isn't an error? If we're handling all errors with a 500 response, shouldn't they also be treated as an error on the library side? Maybe the correct move here should be to change the type of the error callback from Error to unknown

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we want to do this? It would be a breaking change. I'm not opposed but a major bump seems unnecessary.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is also a breaking change technically, just more subtle

@Xetera Xetera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright let's just get this in and remember to do the type change for next major release

@jpbberry
jpbberry merged commit a2d9685 into master Dec 3, 2021
@Xetera
Xetera deleted the feature/fix-unknown-error branch December 3, 2021 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants